#pragma once
#include "stdafx.h"
#include <io.h>
#include <direct.h>

class Cdiv
{
public:
	string div;
};


class CHttpUrl
{
public:
	string m_url, href, title; 
	LPCTSTR m_http , m_szURL;
	int count;
	TCHAR url[MAX_PATH] ;
	LPCTSTR GetAUrl(){
		ZeroMemory(url , MAX_PATH);
		_tcscpy( url , m_http);
		_tcscat( url , href.c_str() );
		return url;
	}
	string GetFileName( LPCSTR base){
		TCHAR ext[5] = {0};
		LPCSTR url = m_url.c_str();
		size_t l = strlen( m_url.c_str() ) - 1;
		for ( int i = 0 ; i < 4; i++)
		{
			ext[ 3-i ] = url[l-i];
		}
		static long k=0;
		stringstream buf[2] ;
		buf[0] << k++;
		buf[1] << count;
		string spath = ( string(base) + buf[1].str() + string("\\") );
		if ( access( spath.c_str() , 0 ) == -1 )
		{
			mkdir( spath.c_str() )	;
		}
		return  spath + title + buf[0].str() + string( ext ) ;
	}

};